package com.imooc.luckymoney.exception;

import com.imooc.luckymoney.enums.ResultEnum;

/**
 * 自定义异常类
 * spring 对于 RuntimeException 异常才会进行事务回滚
 */
public class LuckymoneyException extends RuntimeException {
    private Integer code;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    /**
     * 构造方法
     * @param code
     * @param msg
     */
    public LuckymoneyException(ResultEnum resultEnum){
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }
}
